package com.smedi.ismedi.notification.api.feign;

import com.smedi.ismedi.notification.api.dto.request.MailTemplateRequest;
import com.smedi.ismedi.notification.api.dto.response.MailTemplateResponse;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @version: v1.0.0
 * @author: wzx
 * @date: 2022/11/23 10:05
 * @Description: 邮件模板
 */

@Api(tags = {"邮件模板管理接口"})
@FeignClient(name = "ismedi-notification")
@RequestMapping(value = "/api/v1/notification/mailTemplate")
public interface RemoteMailTemplateFeignApi {

    /**
     * 保存邮件模板信息
     *
     * @param mailTemplateRequest
     * @return
     */
    @ApiOperation(httpMethod = "POST", value = "保存模板信息")
    @PostMapping(value = "/save")
    ResponseData<MailTemplateResponse> postSaveMailTemplate(@RequestBody MailTemplateRequest mailTemplateRequest);

    /**
     * 删除邮件模板信息
     *
     * @param mailTemplateId
     * @return
     */
    @ApiOperation(httpMethod = "DELETE", value = "删除邮件模板信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "mailTemplateId", value = "模板id", dataType = "Long"),
    })
    @DeleteMapping(value = "/delete")
    ResponseData<Boolean> deleteMailTemplate(@RequestParam("mailTemplateId") Long mailTemplateId);

    /**
     * 查看邮件模板表格
     *
     * @param offset
     * @param pageSize
     * @param templateName
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "查看邮件模板表格")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "offset", value = "页码", dataType = "Long"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页行数", dataType = "Long"),
            @ApiImplicitParam(paramType = "query", name = "templateName", value = "模板名称", dataType = "String"),
    })
    @RequestMapping(value = "/queryTemplateTable", method = RequestMethod.GET)
    ResponseData<PaginationData<MailTemplateResponse>> getQueryTemplateTable(@RequestParam("offset") Long offset,
                                                                            @RequestParam("pageSize") Long pageSize,
                                                                            @RequestParam(value = "templateName", required = false) String templateName);

    @ApiOperation(httpMethod = "GET", value = "查看邮件模板")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "mailTemplateId", value = "模板id", dataType = "Long"),
    })
    @RequestMapping(value = "/queryMailTemplate", method = RequestMethod.GET)
    ResponseData<MailTemplateResponse> getQueryMailTemplate(@RequestParam("mailTemplateId") Long mailTemplateId);

}
